package com.auxgroup.smarthome.repo;


import com.auxgroup.smarthome.entity.UserDeviceEntity;
import com.auxgroup.smarthome.vo.DeviceFaultVo;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;


/**
 * 用户设备关系
 */
public interface UserDeviceEntityRepo extends GenericDao<UserDeviceEntity,String> {

    /**
     * modify by lixiaoxiao 20170810 新增根据mac获取绑定主人的用户名和手机号
     */
    @Query("select new com.auxgroup.smarthome.vo.DeviceFaultVo(ds.username,ds.phone,ds.mac,ds.uid) from UserDeviceEntity ds where ds.trash=0 and ds.userTag = 0 and ds.mac = ?1 ")
    DeviceFaultVo findByMac(@Param(value = "mac") String mac);
}
